#ifndef BMPINFO_H
#define BMPINFO_H

typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned char byte;

# pragma pack(push, 1)

// The BMPHEADER structure.
typedef struct {
	 byte        sigB;          /* Magic number is used to identify the BMP file 0x42,0x4D, Hex code for B & M */
	 byte        sigM;          /* BM 2 bytes */

	uint32     fileSize;         /* 4 bytes or 8 bytes, the size of the BMP file in bytes */
	uint16     resv1;            /* 2 bytes or 4 bytes, reserved; actual value depends on the application that creats the image */
	uint16     resv2;            /* 2 bytes or 4 bytes, reserved; actual value depends on the application that creats the image */
	uint32     pixelOffset;      /* 4 bytes of 8 bytes, starting address of the byte where th bitmap can be found */
} BmpFileHeader_p;

typedef struct {
		 uint32   biSize;           /* 4 bytes the size of this header (40 or 80 bytes) */
		 uint32   width;            /* 4 bytes or 8 bytes Width of the image (pixel)*/
		 uint32   height;           /* 4 bytes or 8 bytes Height of the image (pixel) */
		 uint16   planes;           /* 2 bytes or 4 bytes # of color planes byesing used,  must be 1 */
		 uint16   bitPix;           /* 2 bytes or 4 the number of bits per pixel, which is the color depth of the image */
		 uint32   biCompression;    /* 4 bytes or 8 the compression method used */
		 uint32   biSizeImage;      /* 4 bytes or 8 the image size. the size of the raw bitmap data which is not different from the file size */
		 uint32   biXPelsPerMeter;  /* 4 bytes or 8 the horizontal resolution of an image (pixel per meter, signed integer */
		 uint32   biYPelsPerMeter;  /* 4 bytes or 8 the vertical resolution of an image (pixel per meter, signed integeger */
		 uint32   biClrUsed;        /* 4 bytes or 8 # of colors in the color plate, or 0 to default 2^7 */
		 uint32   biClrImportant;   /* 4 bytes or 8 # of important colors used, or 0 when all colors are important; generally ignored */
 }BmpInfoHeader_p;

# pragma pack(pop)

typedef struct {         /* 4  */
   byte rgbBlue;         /* Blue */
   byte rgbGreen;        /* Green */
   byte rgbRed;          /* Red  */
   byte rgbResv;
} BmpRGBQUAD_p;

#endif // BMPINFO_H
